package com.example.project1.model.impl;

import java.util.List;

import android.util.Log;

import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.example.project1.app.ProjectApplication;
import com.example.project1.entity.User;
import com.example.project1.model.YongHuDataModel;
import com.example.project1.utils.ParseYongHu;
import com.example.project1.utils.YongHuDataCallback;

public class YongHuDataModelImpl implements YongHuDataModel{
	@Override
	public void getMYongHuData(final YongHuDataCallback callback) {
	
		String url="http://10.13.26.30/mainWebService.asmx/Android_GetUserjson";
		StringRequest req=new StringRequest(url, new Listener<String>() {

			@Override
			public void onResponse(String response) {
				try {
					List<User> users=ParseYongHu.parse(response);
					Log.v("TAG", users+"");
					callback.getDataCallBack(users);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}, new ErrorListener() {

			@Override
			public void onErrorResponse(VolleyError error) {
				
			}
		});
	ProjectApplication.queue.add(req);
	}

}
